package com.canglion.ragflow.config;

import lombok.Data;

/**
 * rundreams.blog.csdn.net
 *
 * @Time:2025/9/4
 * @Author: Zihao Zhang
 * @description:
 */

@Data
public class RAGFlowConfig {

    private String baseUrl;                 // RAGFlow 地址，如 http://localhost:8080
    private String username;                // 登录邮箱
    private String password;                // 登录密码
    private long tokenRefreshInterval = 30 * 60 * 1000; // 30分钟刷新

    // 构造器
    public RAGFlowConfig(String baseUrl, String username, String password) {
        this.baseUrl = baseUrl;
        this.username = username;
        this.password = password;
    }

    // Builder 模式（可选）
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String baseUrl;
        private String username;
        private String password;
        private long tokenRefreshInterval = 30 * 60 * 1000;

        public Builder baseUrl(String baseUrl) {
            this.baseUrl = baseUrl;
            return this;
        }

        public Builder username(String username) {
            this.username = username;
            return this;
        }

        public Builder password(String password) {
            this.password = password;
            return this;
        }

        public Builder tokenRefreshInterval(long minutes) {
            this.tokenRefreshInterval = minutes * 60 * 1000;
            return this;
        }

        public RAGFlowConfig build() {
            return new RAGFlowConfig(baseUrl, username, password);
        }
    }
}
